<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/font-awesome.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/ionicons.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/AdminLTE.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/skins/all-skins.min.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/plugins/iCheck/square/blue.css">
<title>智慧社区app</title>
</head>
<style>
</style>
<body class="login-page" style="overflow-y: hidden;">
	<div class="login-box" style="margin-top: 160px;">
		<div class="login-box-body">
			<p class="login-box-msg">智慧社区后台</p>
			<form>
				<div class="form-group has-feedback">
					<input id="username" name="username" class="form-control" type="text" placeholder="账号"> <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
				</div>
				<div class="form-group has-feedback">
					<input id="password" name="password" type="password" class="form-control" placeholder="密码"> <span class="glyphicon glyphicon-lock form-control-feedback"></span>
				</div>
				<div class="row">
					<div class="col-xs-8">
						<div class="checkbox icheck">
							<label> <input type="checkbox"> 记住密码
							</label>
						</div>
					</div>
				</div>
				<div class="social-auth-links text-center">
					<button id="submit" type="button" class="btn btn-block btn-facebookbtn-flat" onclick="login();" style="text-align: center;">登录</button>
				</div>
			</form>
			<!-- <div class="social-auth-links text-center">
	      <a href="#" class="btn btn-block btn-facebook btn-flat" style="text-align: center;">登录</a>
	    </div> -->
		</div>
	</div>
</body>
<script src="${pageContext.request.contextPath}/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="${pageContext.request.contextPath}/plugins/bootstrap/js/bootstrap.min.js"></script>
<!-- iCheck -->
<script src="${pageContext.request.contextPath}/plugins/iCheck/icheck.min.js"></script>
<!-- layer -->
<script src="${pageContext.request.contextPath}/plugins/layer/2.4/layer.js"></script>
<script>
	$(function() {
		$('input').iCheck({
			checkboxClass : 'icheckbox_square-blue',
			radioClass : 'iradio_square-blue'/* ,
																								      increaseArea: '20%' */
		});
	});
	function login() {
		var username = $('#username').val();
		var password = $('#password').val();
		$.ajax({
			url : '${pageContext.request.contextPath}/user_login',
			type : 'post',
			data : {
				username : username,
				password : password
			},
			success : function(map) {
				var result = map['result'];
				if (result == 1) {
					layer.msg('登录成功!', {
						icon : 1,
						time : 1500
					});
					setTimeout(function() {
						location.href = "jump_index";
					}, 800);
				} else if (result == 2) {
					layer.msg('密码错误!', {
						icon : 5,
						time : 1500
					});
				} else if (result == -1) {
					layer.msg('账号不存在!', {
						icon : 5,
						time : 1500
					});
				} else {
					layer.msg('登录失败!', {
						icon : 2,
						time : 1500
					});
				}

			}
		});
	}
	$("body").keydown(function() {
		if (event.keyCode == "13") {//keyCode=13是回车键
			$('#submit').click();
		}
	});
</script>
</html>
<%-- <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户登陆</title>
</head>
<body>

<form action="${pageContext.request.contextPath }/submit.do" method="post">
账号：<input type="text" name="userid"/>
<br/>
密码：<input type="text" name="pwd"/>
<input type="submit" value="登陆"/> 
</form>

</body>
</html> --%>